package com.gitee.muii.echarts.options.series;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gitee.muii.echarts.options.series.line.SeriesLine;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class Series implements Serializable {
    
    private static final long serialVersionUID = -4240546088585056500L;
    
    protected String id;
    protected String type;
    protected String name;
    //todo 在option中操作
    @JsonIgnore
    protected Series clazz;
    
    protected static final String SERIES_LINE = "line";
    
    public Series(String type) {
        if (SERIES_LINE.equals(type)) {
            this.clazz = new SeriesLine();
        }
    }
    
    protected String propertyOrDefault(List<String> properties, String property) {
        return this.propertyOrDefault(properties, property, "");
    }
    
    protected String propertyOrDefault(List<String> properties, String property, String defaultProperty) {
        if (properties.contains(property)) {
            return property;
        }
        return defaultProperty;
    }
    
}
